package com.example.attempt.service.impl;

import com.example.attempt.entity.SelectCourse;
import com.example.attempt.entity.Student;
import com.example.attempt.mapper.SelectCourseMapper;
import com.example.attempt.service.SelectCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SelectCourseServiceImpl implements SelectCourseService {
    @Autowired
    SelectCourseMapper selectCourseMapper;
    @Override
    public List<SelectCourse> queryAll(){
        return selectCourseMapper.queryAll();
    }

    @Override
    public SelectCourse queryOne(SelectCourse select){
        return selectCourseMapper.queryOne(select);
    }

    @Override
    public List<SelectCourse> queryByCid(String cid){
        return selectCourseMapper.queryByCid(cid);
    }

    @Override
    public List<SelectCourse> queryBySid(String sid){
        return selectCourseMapper.queryBySid(sid);
    }

    @Override
    public int addStudentToCourse(SelectCourse select){
        selectCourseMapper.addStudentToCourse(select);
        return 1;
    }

    @Override
    public void deleteStudentFromCourse(SelectCourse select){
        selectCourseMapper.deleteStudentFromCourse(select);
    }

    @Override
    public List<Student> getStudents(String cid) {
        return selectCourseMapper.getStudents(cid);
    }
}
